{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# 12.7.3. The Algorithm\n",
    "$\\begin{split}\\begin{aligned}\n",
    "    \\mathbf{g}_t & = \\partial_{\\mathbf{w}} l(y_t, f(\\mathbf{x}_t, \\mathbf{w})), \\\\\n",
    "    \\mathbf{s}_t & = \\mathbf{s}_{t-1} + \\mathbf{g}_t^2, \\\\\n",
    "    \\mathbf{w}_t & = \\mathbf{w}_{t-1} - \\frac{\\eta}{\\sqrt{\\mathbf{s}_t + \\epsilon}} \\cdot \\mathbf{g}_t.\n",
    "\\end{aligned}\\end{split}$"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "79ae32cefc493b56"
  },
  {
   "cell_type": "markdown",
   "source": [
    "使用例子 $f(\\mathbf{x}) = 0.1 x_1^2 + 2 x_2^2.$"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "78b0ffb8c62cfcd1"
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch 20, x1: -2.382563, x2: -0.158591\n"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 350x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"245.120313pt\" height=\"183.35625pt\" viewBox=\"0 0 245.120313 183.35625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2025-03-02T10:14:57.189278</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.0, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 183.35625 \nL 245.120313 183.35625 \nL 245.120313 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 42.620312 145.8 \nL 237.920313 145.8 \nL 237.920313 7.2 \nL 42.620312 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <defs>\n       <path id=\"m55df993c7f\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m55df993c7f\" x=\"88.39375\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- −4 -->\n      <g transform=\"translate(81.022656 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \nL 4684 2272 \nL 4684 1741 \nL 678 1741 \nL 678 2272 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-34\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_2\">\n      <g>\n       <use xlink:href=\"#m55df993c7f\" x=\"149.425\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- −2 -->\n      <g transform=\"translate(142.053907 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_3\">\n      <g>\n       <use xlink:href=\"#m55df993c7f\" x=\"210.456251\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 0 -->\n      <g transform=\"translate(207.275001 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_4\">\n     <!-- x1 -->\n     <g transform=\"translate(134.129687 174.076563) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \nL 2247 1797 \nL 3578 0 \nL 2900 0 \nL 1881 1375 \nL 863 0 \nL 184 0 \nL 1544 1831 \nL 300 3500 \nL 978 3500 \nL 1906 2253 \nL 2834 3500 \nL 3513 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-78\"/>\n      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(59.179688 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_4\">\n      <defs>\n       <path id=\"mbc7fbe2664\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mbc7fbe2664\" x=\"42.620312\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- −3 -->\n      <g transform=\"translate(20.878125 149.599219) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_5\">\n      <g>\n       <use xlink:href=\"#mbc7fbe2664\" x=\"42.620312\" y=\"110.261538\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- −2 -->\n      <g transform=\"translate(20.878125 114.060757) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#mbc7fbe2664\" x=\"42.620312\" y=\"74.723076\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- −1 -->\n      <g transform=\"translate(20.878125 78.522295) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_7\">\n      <g>\n       <use xlink:href=\"#mbc7fbe2664\" x=\"42.620312\" y=\"39.184615\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 0 -->\n      <g transform=\"translate(29.257812 42.983833) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_9\">\n     <!-- x2 -->\n     <g transform=\"translate(14.798437 82.640625) rotate(-90) scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-78\"/>\n      <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(59.179688 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_8\">\n    <path d=\"M 57.878125 110.261538 \nL 70.084369 96.046154 \nL 78.348688 87.165873 \nL 84.908015 80.537052 \nL 90.459611 75.236107 \nL 95.325825 70.841109 \nL 99.686585 67.116708 \nL 103.654327 63.914925 \nL 107.304852 61.134891 \nL 110.692126 58.703726 \nL 113.856191 56.566407 \nL 116.827734 54.679956 \nL 119.630892 53.009887 \nL 122.285063 51.527936 \nL 124.806116 50.210531 \nL 127.207235 49.037745 \nL 129.499519 47.992541 \nL 131.692415 47.060222 \nL 133.79405 46.228018 \nL 135.811476 45.48477 \nL 137.750858 44.820679 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square\"/>\n    <defs>\n     <path id=\"m638b5a3d90\" d=\"M 0 3 \nC 0.795609 3 1.55874 2.683901 2.12132 2.12132 \nC 2.683901 1.55874 3 0.795609 3 0 \nC 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \nC 1.55874 -2.683901 0.795609 -3 0 -3 \nC -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \nC -2.683901 -1.55874 -3 -0.795609 -3 0 \nC -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \nC -1.55874 2.683901 -0.795609 3 0 3 \nz\n\" style=\"stroke: #ff7f0e\"/>\n    </defs>\n    <g clip-path=\"url(#p238fe37a01)\">\n     <use xlink:href=\"#m638b5a3d90\" x=\"57.878125\" y=\"110.261538\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"70.084369\" y=\"96.046154\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"78.348688\" y=\"87.165873\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"84.908015\" y=\"80.537052\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"90.459611\" y=\"75.236107\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"95.325825\" y=\"70.841109\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"99.686585\" y=\"67.116708\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"103.654327\" y=\"63.914925\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"107.304852\" y=\"61.134891\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"110.692126\" y=\"58.703726\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"113.856191\" y=\"56.566407\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"116.827734\" y=\"54.679956\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"119.630892\" y=\"53.009887\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"122.285063\" y=\"51.527936\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"124.806116\" y=\"50.210531\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"127.207235\" y=\"49.037745\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"129.499519\" y=\"47.992541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"131.692415\" y=\"47.060222\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"133.79405\" y=\"46.228018\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"135.811476\" y=\"45.48477\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#m638b5a3d90\" x=\"137.750858\" y=\"44.820679\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n    </g>\n   </g>\n   <g id=\"QuadContourSet_1\">\n    <path clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 97.100868 7.2 \nL 94.496869 7.868961 \nL 91.44531 8.673801 \nL 88.393757 9.499545 \nL 85.342191 10.346198 \nL 83.908323 10.753845 \nL 82.290631 11.275074 \nL 79.239071 12.281998 \nL 76.187512 13.312611 \nL 73.307377 14.307692 \nL 73.135938 14.376037 \nL 70.084378 15.61988 \nL 67.032818 16.891062 \nL 64.752171 17.861537 \nL 63.981244 18.249232 \nL 60.929685 19.816153 \nL 57.878125 21.415384 \nL 57.878125 21.415384 \nL 54.826565 23.409482 \nL 52.48604 24.96923 \nL 51.775006 25.578453 \nL 48.723432 28.243853 \nL 48.409729 28.523076 \nL 45.671872 31.93477 \nL 45.55989 32.076922 \nL 43.880133 35.630769 \nL 43.320214 39.184616 \nL 43.880133 42.738462 \nL 45.55989 46.292308 \nL 45.671872 46.43446 \nL 48.409729 49.846154 \nL 48.723432 50.125377 \nL 51.775006 52.790777 \nL 52.486042 53.400001 \nL 54.826565 54.959745 \nL 57.878125 56.953846 \nL 57.878125 56.953846 \nL 60.929685 58.553076 \nL 63.981244 60.119998 \nL 64.752171 60.507693 \nL 67.032818 61.478167 \nL 70.084378 62.749349 \nL 73.135938 63.993193 \nL 73.307377 64.061538 \nL 76.187512 65.056618 \nL 79.239071 66.087232 \nL 82.290631 67.094156 \nL 83.908319 67.615382 \nL 85.342191 68.02303 \nL 88.393757 68.869685 \nL 91.44531 69.695427 \nL 94.496869 70.500269 \nL 97.100868 71.169229 \nL 97.548436 71.272105 \nL 100.599996 71.954818 \nL 103.651563 72.618826 \nL 106.703122 73.264128 \nL 109.754682 73.890726 \nL 112.806249 74.498621 \nL 113.968755 74.723076 \nL 115.857816 75.053077 \nL 118.909375 75.56923 \nL 121.960942 76.068463 \nL 125.012502 76.55077 \nL 128.064069 77.016155 \nL 131.115628 77.464616 \nL 134.167188 77.896154 \nL 136.969651 78.276924 \nL 137.218755 78.307826 \nL 140.270314 78.670936 \nL 143.321874 79.018595 \nL 146.373441 79.350803 \nL 149.425 79.667558 \nL 152.476564 79.968862 \nL 155.528127 80.254716 \nL 158.57969 80.525117 \nL 161.631253 80.780066 \nL 164.682813 81.019566 \nL 167.730736 81.243344 \nM 179.948642 81.973278 \nL 182.992189 82.107968 \nL 186.04375 82.228801 \nL 189.095313 82.335415 \nL 192.146877 82.427815 \nL 195.198438 82.505999 \nL 198.250001 82.569969 \nL 201.301564 82.619722 \nL 204.353126 82.655262 \nL 207.404689 82.676585 \nL 210.456251 82.683692 \nL 213.507813 82.676585 \nL 216.559376 82.655262 \nL 219.610939 82.619722 \nL 222.662501 82.569969 \nL 225.714063 82.505999 \nL 228.765626 82.427815 \nL 231.817188 82.335415 \nL 234.868751 82.228801 \nL 237.920313 82.107968 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 82.505999 \nL 45.671872 83.280739 \nL 48.723432 84.041258 \nL 51.775006 84.78757 \nL 54.263642 85.384613 \nL 54.826565 85.509659 \nL 57.878125 86.174359 \nL 60.929685 86.825897 \nL 63.981244 87.464272 \nL 67.032818 88.089488 \nL 70.084378 88.701539 \nL 71.29158 88.93846 \nL 73.135938 89.275465 \nL 76.187512 89.820797 \nL 79.239071 90.353873 \nL 82.290631 90.874696 \nL 85.342191 91.383263 \nL 88.393757 91.879576 \nL 91.44531 92.363634 \nL 92.277553 92.492307 \nL 94.496869 92.813298 \nL 97.548436 93.243201 \nL 100.599996 93.661637 \nL 103.651563 94.06861 \nL 106.703122 94.464117 \nL 109.754682 94.848161 \nL 112.806249 95.220742 \nL 115.857816 95.58186 \nL 118.909375 95.931512 \nL 118.925037 95.933247 \nM 131.104896 97.14361 \nL 131.115628 97.144614 \nL 134.167188 97.41923 \nL 137.218755 97.683078 \nL 140.270314 97.936154 \nL 143.321874 98.17846 \nL 146.373441 98.41 \nL 149.425 98.630769 \nL 152.476564 98.840769 \nL 155.528127 99.040001 \nL 158.57969 99.228461 \nL 161.631253 99.406154 \nL 164.682813 99.573078 \nL 165.20896 99.600001 \nL 167.734376 99.721846 \nL 170.785939 99.858923 \nL 173.837499 99.985846 \nL 176.889062 100.102617 \nL 179.940626 100.209232 \nL 182.992189 100.305693 \nL 186.04375 100.392 \nL 189.095313 100.468155 \nL 192.146877 100.534155 \nL 195.198438 100.59 \nL 198.250001 100.635694 \nL 201.301564 100.671232 \nL 204.353126 100.696615 \nL 207.404689 100.711847 \nL 210.456251 100.716923 \nL 213.507813 100.711847 \nL 216.559376 100.696615 \nL 219.610939 100.671232 \nL 222.662501 100.635694 \nL 225.714063 100.59 \nL 228.765626 100.534155 \nL 231.817188 100.468155 \nL 234.868751 100.392 \nL 237.920313 100.305693 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 100.589999 \nL 45.671872 101.143384 \nL 48.723432 101.686614 \nL 51.775006 102.219694 \nL 54.826565 102.742616 \nL 57.27387 103.153848 \nL 57.878125 103.249896 \nL 60.929685 103.725343 \nL 63.981244 104.191185 \nL 67.032818 104.647423 \nL 70.084378 105.094054 \nL 73.135938 105.53108 \nL 76.187512 105.958505 \nL 79.239071 106.376322 \nL 81.716227 106.707695 \nL 82.274465 106.778542 \nM 94.517374 108.240876 \nL 97.548436 108.580295 \nL 100.599996 108.912898 \nL 103.651563 109.236389 \nL 106.703122 109.550769 \nL 109.754682 109.856036 \nL 112.806249 110.152188 \nL 113.968764 110.261538 \nL 115.857816 110.430561 \nL 118.909375 110.694936 \nL 121.960942 110.950639 \nL 125.012502 111.197671 \nL 128.064069 111.43604 \nL 131.115628 111.665742 \nL 134.167188 111.886772 \nL 137.218755 112.099135 \nL 140.270314 112.302831 \nL 143.321874 112.497859 \nL 146.373441 112.68422 \nL 149.425 112.861914 \nL 152.476564 113.030936 \nL 155.528127 113.191291 \nL 158.57969 113.342983 \nL 161.631253 113.486004 \nL 164.682813 113.620353 \nL 167.734376 113.746039 \nL 169.542874 113.81539 \nL 170.785939 113.86084 \nL 173.837499 113.964148 \nL 176.889062 114.059192 \nL 179.940626 114.145972 \nL 182.992189 114.224487 \nL 186.04375 114.294739 \nL 189.095313 114.356726 \nL 192.146877 114.410445 \nL 195.198438 114.455904 \nL 198.250001 114.493094 \nL 201.301564 114.522021 \nL 204.353126 114.542683 \nL 207.404689 114.555078 \nL 210.456251 114.559212 \nL 213.507813 114.555078 \nL 216.559376 114.542683 \nL 219.610939 114.522021 \nL 222.662501 114.493094 \nL 225.714063 114.455904 \nL 228.765626 114.410445 \nL 231.817188 114.356726 \nL 234.868751 114.294739 \nL 237.920313 114.224487 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 114.455904 \nL 45.671872 114.90633 \nL 48.723432 115.348496 \nL 51.775006 115.782398 \nL 54.826565 116.208033 \nL 57.878125 116.625402 \nL 60.929685 117.034508 \nL 63.477901 117.369232 \nL 63.981244 117.432411 \nL 67.032818 117.80754 \nL 70.084378 118.174768 \nL 73.135938 118.534104 \nL 76.187512 118.885538 \nL 79.239071 119.229076 \nL 82.290631 119.564717 \nL 85.342191 119.892461 \nL 88.393757 120.212309 \nL 91.44531 120.524255 \nL 94.496869 120.828305 \nL 95.47338 120.923075 \nL 97.548436 121.115889 \nL 100.599996 121.391879 \nL 103.651563 121.660309 \nL 106.703122 121.921177 \nL 109.754682 122.174485 \nL 112.806249 122.420228 \nL 115.857816 122.658411 \nL 118.909375 122.889036 \nL 121.960942 123.112097 \nL 125.012502 123.327593 \nL 128.064069 123.535532 \nL 131.115628 123.735911 \nL 134.167188 123.928724 \nL 137.218755 124.113977 \nL 140.270314 124.29167 \nL 143.321874 124.461801 \nL 143.605786 124.476926 \nL 146.373441 124.618353 \nL 149.425 124.767036 \nL 152.476564 124.908463 \nL 155.528127 125.042637 \nL 158.57969 125.169563 \nL 161.631253 125.289234 \nL 164.682813 125.401648 \nL 167.734376 125.506814 \nL 170.785939 125.604728 \nL 173.837499 125.695385 \nL 174.30988 125.708297 \nM 191.675773 126.079755 \nL 192.146877 126.087033 \nL 195.198438 126.126925 \nL 198.250001 126.159562 \nL 201.301564 126.184946 \nL 204.353126 126.203079 \nL 207.404689 126.213955 \nL 210.456251 126.217583 \nL 213.507813 126.213955 \nL 216.559376 126.203079 \nL 219.610939 126.184946 \nL 222.662501 126.159562 \nL 225.714063 126.126925 \nL 228.765626 126.087033 \nL 231.817188 126.039892 \nL 234.868751 125.985495 \nL 237.920313 125.923846 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 126.126925 \nL 45.671872 126.522197 \nL 48.723432 126.91022 \nL 51.775006 127.290991 \nL 54.826565 127.664506 \nL 57.878125 128.030769 \nL 57.878125 128.030769 \nL 60.929685 128.375701 \nL 63.981244 128.713666 \nL 67.032818 129.044662 \nL 70.084378 129.368688 \nL 73.135938 129.685749 \nL 76.187512 129.995838 \nL 79.239071 130.29896 \nL 82.290631 130.595114 \nL 85.342191 130.884301 \nL 88.393757 131.166519 \nL 91.44531 131.441767 \nL 93.070112 131.584612 \nL 94.496869 131.705313 \nL 97.548436 131.956763 \nL 100.599996 132.201509 \nL 103.651563 132.43955 \nL 106.703122 132.670885 \nL 109.754682 132.895516 \nL 112.806249 133.113439 \nL 115.857816 133.324659 \nL 118.909375 133.529174 \nL 121.960942 133.726982 \nL 125.012502 133.918082 \nL 128.064069 134.102481 \nL 131.115628 134.280175 \nL 134.167188 134.45116 \nL 134.693324 134.479485 \nM 151.953329 135.307471 \nL 152.476564 135.329076 \nL 155.528127 135.448613 \nL 158.57969 135.561693 \nL 161.631253 135.668308 \nL 164.682813 135.768459 \nL 167.734376 135.862153 \nL 170.785939 135.949385 \nL 173.837499 136.030153 \nL 176.889062 136.10446 \nL 179.940626 136.172306 \nL 182.992189 136.233691 \nL 186.04375 136.288614 \nL 189.095313 136.337077 \nL 192.146877 136.379075 \nL 195.198438 136.414616 \nL 198.250001 136.443692 \nL 201.301564 136.466308 \nL 204.353126 136.482462 \nL 207.404689 136.492152 \nL 210.456251 136.495384 \nL 213.507813 136.492152 \nL 216.559376 136.482462 \nL 219.610939 136.466308 \nL 222.662501 136.443692 \nL 225.714063 136.414616 \nL 228.765626 136.379075 \nL 231.817188 136.337077 \nL 234.868751 136.288614 \nL 237.920313 136.233691 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 136.414613 \nL 45.671872 136.766771 \nL 48.723432 137.112458 \nL 51.775006 137.451694 \nL 54.826565 137.784465 \nL 57.878125 138.110766 \nL 60.929685 138.430616 \nL 63.477871 138.692306 \nL 63.981244 138.742187 \nL 67.032818 139.038339 \nL 70.084378 139.328259 \nL 73.135938 139.611942 \nL 76.187512 139.889394 \nL 79.239071 140.160608 \nL 82.290631 140.425588 \nL 85.342191 140.684331 \nL 88.393757 140.936841 \nL 91.44531 141.183116 \nL 94.496869 141.423157 \nL 97.548436 141.656963 \nL 100.599996 141.884534 \nL 103.651563 142.105868 \nL 105.641791 142.246157 \nL 106.703122 142.318434 \nL 109.754682 142.520218 \nL 112.806249 142.715983 \nL 115.857816 142.905721 \nL 118.909375 143.089439 \nL 121.960942 143.267132 \nL 125.012502 143.438798 \nL 128.064069 143.604445 \nL 131.115628 143.764065 \nL 134.167188 143.917665 \nL 137.218755 144.06524 \nL 140.270314 144.206794 \nL 143.321874 144.342322 \nL 146.373441 144.471825 \nL 149.425 144.595307 \nL 152.476564 144.712763 \nL 155.528127 144.8242 \nL 158.57969 144.92961 \nL 161.631253 145.028994 \nL 164.682813 145.122358 \nL 167.734376 145.209702 \nL 170.785939 145.291015 \nL 173.837499 145.366313 \nL 176.889062 145.435579 \nL 177.36027 145.445345 \nM 194.728013 145.719601 \nL 195.198438 145.724708 \nL 198.250001 145.75181 \nL 201.301564 145.772892 \nL 204.353126 145.787954 \nL 207.404689 145.79699 \nL 210.456251 145.8 \nM 210.456251 145.8 \nL 213.507813 145.79699 \nL 216.559376 145.787954 \nL 217.029288 145.785635 \nM 234.398349 145.614215 \nL 234.868751 145.607251 \nL 237.920313 145.556051 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 145.724708 \nL 43.320206 145.8 \n\" clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path clip-path=\"url(#p238fe37a01)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 42.620312 145.8 \nL 42.620312 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 237.920313 145.8 \nL 237.920313 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 42.620312 145.8 \nL 237.920313 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 42.620312 7.2 \nL 237.920313 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_10\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 3 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(171.163301 83.694434) rotate(-356.522918) scale(0.08 -0.08)\">\n      <use xlink:href=\"#DejaVuSans-33\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_11\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 6 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(122.262761 98.509614) rotate(-354.356686) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \nQ 1688 2584 1439 2293 \nQ 1191 2003 1191 1497 \nQ 1191 994 1439 701 \nQ 1688 409 2113 409 \nQ 2538 409 2786 701 \nQ 3034 994 3034 1497 \nQ 3034 2003 2786 2293 \nQ 2538 2584 2113 2584 \nz\nM 3366 4563 \nL 3366 3988 \nQ 3128 4100 2886 4159 \nQ 2644 4219 2406 4219 \nQ 1781 4219 1451 3797 \nQ 1122 3375 1075 2522 \nQ 1259 2794 1537 2939 \nQ 1816 3084 2150 3084 \nQ 2853 3084 3261 2657 \nQ 3669 2231 3669 1497 \nQ 3669 778 3244 343 \nQ 2819 -91 2113 -91 \nQ 1303 -91 875 529 \nQ 447 1150 447 2328 \nQ 447 3434 972 4092 \nQ 1497 4750 2381 4750 \nQ 2619 4750 2861 4703 \nQ 3103 4656 3366 4563 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-36\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_12\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 9 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(85.604905 109.417886) rotate(-353.188529) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-39\" d=\"M 703 97 \nL 703 672 \nQ 941 559 1184 500 \nQ 1428 441 1663 441 \nQ 2288 441 2617 861 \nQ 2947 1281 2994 2138 \nQ 2813 1869 2534 1725 \nQ 2256 1581 1919 1581 \nQ 1219 1581 811 2004 \nQ 403 2428 403 3163 \nQ 403 3881 828 4315 \nQ 1253 4750 1959 4750 \nQ 2769 4750 3195 4129 \nQ 3622 3509 3622 2328 \nQ 3622 1225 3098 567 \nQ 2575 -91 1691 -91 \nQ 1453 -91 1209 -44 \nQ 966 3 703 97 \nz\nM 1959 2075 \nQ 2384 2075 2632 2365 \nQ 2881 2656 2881 3163 \nQ 2881 3666 2632 3958 \nQ 2384 4250 1959 4250 \nQ 1534 4250 1286 3958 \nQ 1038 3666 1038 3163 \nQ 1038 2656 1286 2365 \nQ 1534 2075 1959 2075 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-39\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_13\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 12 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(177.856144 128.021988) rotate(-358.774598) scale(0.08 -0.08)\">\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_14\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 15 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(138.131355 136.883395) rotate(-357.236288) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_15\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 18 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(180.91953 147.734109) rotate(-359.095302) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \nQ 1584 2216 1326 1975 \nQ 1069 1734 1069 1313 \nQ 1069 891 1326 650 \nQ 1584 409 2034 409 \nQ 2484 409 2743 651 \nQ 3003 894 3003 1313 \nQ 3003 1734 2745 1975 \nQ 2488 2216 2034 2216 \nz\nM 1403 2484 \nQ 997 2584 770 2862 \nQ 544 3141 544 3541 \nQ 544 4100 942 4425 \nQ 1341 4750 2034 4750 \nQ 2731 4750 3128 4425 \nQ 3525 4100 3525 3541 \nQ 3525 3141 3298 2862 \nQ 3072 2584 2669 2484 \nQ 3125 2378 3379 2068 \nQ 3634 1759 3634 1313 \nQ 3634 634 3220 271 \nQ 2806 -91 2034 -91 \nQ 1263 -91 848 271 \nQ 434 634 434 1313 \nQ 434 1759 690 2068 \nQ 947 2378 1403 2484 \nz\nM 1172 3481 \nQ 1172 3119 1398 2916 \nQ 1625 2713 2034 2713 \nQ 2441 2713 2670 2916 \nQ 2900 3119 2900 3481 \nQ 2900 3844 2670 4047 \nQ 2441 4250 2034 4250 \nQ 1625 4250 1398 4047 \nQ 1172 3844 1172 3481 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_16\">\n    <g clip-path=\"url(#p238fe37a01)\">\n     <!-- 18 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(220.646096 147.982332) rotate(-0.565439) scale(0.08 -0.08)\">\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p238fe37a01\">\n   <rect x=\"42.620312\" y=\"7.2\" width=\"195.3\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import math\n",
    "import torch\n",
    "import d2l\n",
    "\n",
    "def adagrad_2d(x1, x2, s1, s2):\n",
    "    eps = 1e-6\n",
    "    g1, g2 = 0.2 * x1, 4 * x2\n",
    "    s1 += g1 ** 2\n",
    "    s2 += g2 ** 2\n",
    "    x1 -= eta / math.sqrt(s1 + eps) * g1\n",
    "    x2 -= eta / math.sqrt(s2 + eps) * g2\n",
    "    return x1, x2, s1, s2\n",
    "\n",
    "def f_2d(x1, x2):\n",
    "    return 0.1 * x1 ** 2 + 2 * x2 ** 2\n",
    "\n",
    "eta = 0.4\n",
    "d2l.show_trace_2d(f_2d, d2l.train_2d(adagrad_2d))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-03-02T02:14:57.215386Z",
     "start_time": "2025-03-02T02:14:53.473257Z"
    }
   },
   "id": "6e23e1b236100595",
   "execution_count": 1
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch 20, x1: -0.002295, x2: -0.000000\n"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 350x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"245.120313pt\" height=\"183.35625pt\" viewBox=\"0 0 245.120313 183.35625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2025-03-02T10:18:50.758377</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.0, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 183.35625 \nL 245.120313 183.35625 \nL 245.120313 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 42.620312 145.8 \nL 237.920313 145.8 \nL 237.920313 7.2 \nL 42.620312 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <defs>\n       <path id=\"mec42085d00\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mec42085d00\" x=\"88.39375\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- −4 -->\n      <g transform=\"translate(81.022656 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \nL 4684 2272 \nL 4684 1741 \nL 678 1741 \nL 678 2272 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-34\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_2\">\n      <g>\n       <use xlink:href=\"#mec42085d00\" x=\"149.425\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- −2 -->\n      <g transform=\"translate(142.053907 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_3\">\n      <g>\n       <use xlink:href=\"#mec42085d00\" x=\"210.456251\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 0 -->\n      <g transform=\"translate(207.275001 160.398438) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_4\">\n     <!-- x1 -->\n     <g transform=\"translate(134.129687 174.076563) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \nL 2247 1797 \nL 3578 0 \nL 2900 0 \nL 1881 1375 \nL 863 0 \nL 184 0 \nL 1544 1831 \nL 300 3500 \nL 978 3500 \nL 1906 2253 \nL 2834 3500 \nL 3513 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-78\"/>\n      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(59.179688 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_4\">\n      <defs>\n       <path id=\"m2015c37a43\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m2015c37a43\" x=\"42.620312\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- −3 -->\n      <g transform=\"translate(20.878125 149.599219) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_5\">\n      <g>\n       <use xlink:href=\"#m2015c37a43\" x=\"42.620312\" y=\"110.261538\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- −2 -->\n      <g transform=\"translate(20.878125 114.060757) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m2015c37a43\" x=\"42.620312\" y=\"74.723076\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- −1 -->\n      <g transform=\"translate(20.878125 78.522295) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-2212\"/>\n       <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_7\">\n      <g>\n       <use xlink:href=\"#m2015c37a43\" x=\"42.620312\" y=\"39.184615\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 0 -->\n      <g transform=\"translate(29.257812 42.983833) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_9\">\n     <!-- x2 -->\n     <g transform=\"translate(14.798437 82.640625) rotate(-90) scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-78\"/>\n      <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(59.179688 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_8\">\n    <path d=\"M 57.878125 110.261538 \nL 118.909345 39.184615 \nL 150.30966 39.184615 \nL 169.853409 39.184615 \nL 182.748839 39.184615 \nL 191.45862 39.184615 \nL 197.40211 39.184615 \nL 201.47704 39.184615 \nL 204.277004 39.184615 \nL 206.202904 39.184615 \nL 207.528241 39.184615 \nL 208.440503 39.184615 \nL 209.068504 39.184615 \nL 209.500842 39.184615 \nL 209.798486 39.184615 \nL 210.003402 39.184615 \nL 210.144479 39.184615 \nL 210.241606 39.184615 \nL 210.308475 39.184615 \nL 210.354512 39.184615 \nL 210.386207 39.184615 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square\"/>\n    <defs>\n     <path id=\"maa0ab604f3\" d=\"M 0 3 \nC 0.795609 3 1.55874 2.683901 2.12132 2.12132 \nC 2.683901 1.55874 3 0.795609 3 0 \nC 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \nC 1.55874 -2.683901 0.795609 -3 0 -3 \nC -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \nC -2.683901 -1.55874 -3 -0.795609 -3 0 \nC -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \nC -1.55874 2.683901 -0.795609 3 0 3 \nz\n\" style=\"stroke: #ff7f0e\"/>\n    </defs>\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <use xlink:href=\"#maa0ab604f3\" x=\"57.878125\" y=\"110.261538\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"118.909345\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"150.30966\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"169.853409\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"182.748839\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"191.45862\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"197.40211\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"201.47704\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"204.277004\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"206.202904\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"207.528241\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"208.440503\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"209.068504\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"209.500842\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"209.798486\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"210.003402\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"210.144479\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"210.241606\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"210.308475\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"210.354512\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n     <use xlink:href=\"#maa0ab604f3\" x=\"210.386207\" y=\"39.184615\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n    </g>\n   </g>\n   <g id=\"QuadContourSet_1\">\n    <path clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 97.100868 7.2 \nL 94.496869 7.868961 \nL 91.44531 8.673801 \nL 88.393757 9.499545 \nL 85.342191 10.346198 \nL 83.908323 10.753845 \nL 82.290631 11.275074 \nL 79.239071 12.281998 \nL 76.187512 13.312611 \nL 73.307377 14.307692 \nL 73.135938 14.376037 \nL 70.084378 15.61988 \nL 67.032818 16.891062 \nL 64.752171 17.861537 \nL 63.981244 18.249232 \nL 60.929685 19.816153 \nL 57.878125 21.415384 \nL 57.878125 21.415384 \nL 54.826565 23.409482 \nL 52.48604 24.96923 \nL 51.775006 25.578453 \nL 48.723432 28.243853 \nL 48.409729 28.523076 \nL 45.671872 31.93477 \nL 45.55989 32.076922 \nL 43.880133 35.630769 \nL 43.320214 39.184616 \nL 43.880133 42.738462 \nL 45.55989 46.292308 \nL 45.671872 46.43446 \nL 48.409729 49.846154 \nL 48.723432 50.125377 \nL 51.775006 52.790777 \nL 52.486042 53.400001 \nL 54.826565 54.959745 \nL 57.878125 56.953846 \nL 57.878125 56.953846 \nL 60.929685 58.553076 \nL 63.981244 60.119998 \nL 64.752171 60.507693 \nL 67.032818 61.478167 \nL 70.084378 62.749349 \nL 73.135938 63.993193 \nL 73.307377 64.061538 \nL 76.187512 65.056618 \nL 79.239071 66.087232 \nL 82.290631 67.094156 \nL 83.908319 67.615382 \nL 85.342191 68.02303 \nL 88.393757 68.869685 \nL 91.44531 69.695427 \nL 94.496869 70.500269 \nL 97.100868 71.169229 \nL 97.548436 71.272105 \nL 100.599996 71.954818 \nL 103.651563 72.618826 \nL 106.703122 73.264128 \nL 109.754682 73.890726 \nL 112.806249 74.498621 \nL 113.968755 74.723076 \nL 115.857816 75.053077 \nL 118.909375 75.56923 \nL 121.960942 76.068463 \nL 125.012502 76.55077 \nL 128.064069 77.016155 \nL 131.115628 77.464616 \nL 134.167188 77.896154 \nL 136.969651 78.276924 \nL 137.218755 78.307826 \nL 140.270314 78.670936 \nL 143.321874 79.018595 \nL 146.373441 79.350803 \nL 149.425 79.667558 \nL 152.476564 79.968862 \nL 155.528127 80.254716 \nL 158.57969 80.525117 \nL 161.631253 80.780066 \nL 164.682813 81.019566 \nL 167.730736 81.243344 \nM 179.948642 81.973278 \nL 182.992189 82.107968 \nL 186.04375 82.228801 \nL 189.095313 82.335415 \nL 192.146877 82.427815 \nL 195.198438 82.505999 \nL 198.250001 82.569969 \nL 201.301564 82.619722 \nL 204.353126 82.655262 \nL 207.404689 82.676585 \nL 210.456251 82.683692 \nL 213.507813 82.676585 \nL 216.559376 82.655262 \nL 219.610939 82.619722 \nL 222.662501 82.569969 \nL 225.714063 82.505999 \nL 228.765626 82.427815 \nL 231.817188 82.335415 \nL 234.868751 82.228801 \nL 237.920313 82.107968 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 82.505999 \nL 45.671872 83.280739 \nL 48.723432 84.041258 \nL 51.775006 84.78757 \nL 54.263642 85.384613 \nL 54.826565 85.509659 \nL 57.878125 86.174359 \nL 60.929685 86.825897 \nL 63.981244 87.464272 \nL 67.032818 88.089488 \nL 70.084378 88.701539 \nL 71.29158 88.93846 \nL 73.135938 89.275465 \nL 76.187512 89.820797 \nL 79.239071 90.353873 \nL 82.290631 90.874696 \nL 85.342191 91.383263 \nL 88.393757 91.879576 \nL 91.44531 92.363634 \nL 92.277553 92.492307 \nL 94.496869 92.813298 \nL 97.548436 93.243201 \nL 100.599996 93.661637 \nL 103.651563 94.06861 \nL 106.703122 94.464117 \nL 109.754682 94.848161 \nL 112.806249 95.220742 \nL 115.857816 95.58186 \nL 118.909375 95.931512 \nL 118.925037 95.933247 \nM 131.104896 97.14361 \nL 131.115628 97.144614 \nL 134.167188 97.41923 \nL 137.218755 97.683078 \nL 140.270314 97.936154 \nL 143.321874 98.17846 \nL 146.373441 98.41 \nL 149.425 98.630769 \nL 152.476564 98.840769 \nL 155.528127 99.040001 \nL 158.57969 99.228461 \nL 161.631253 99.406154 \nL 164.682813 99.573078 \nL 165.20896 99.600001 \nL 167.734376 99.721846 \nL 170.785939 99.858923 \nL 173.837499 99.985846 \nL 176.889062 100.102617 \nL 179.940626 100.209232 \nL 182.992189 100.305693 \nL 186.04375 100.392 \nL 189.095313 100.468155 \nL 192.146877 100.534155 \nL 195.198438 100.59 \nL 198.250001 100.635694 \nL 201.301564 100.671232 \nL 204.353126 100.696615 \nL 207.404689 100.711847 \nL 210.456251 100.716923 \nL 213.507813 100.711847 \nL 216.559376 100.696615 \nL 219.610939 100.671232 \nL 222.662501 100.635694 \nL 225.714063 100.59 \nL 228.765626 100.534155 \nL 231.817188 100.468155 \nL 234.868751 100.392 \nL 237.920313 100.305693 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 100.589999 \nL 45.671872 101.143384 \nL 48.723432 101.686614 \nL 51.775006 102.219694 \nL 54.826565 102.742616 \nL 57.27387 103.153848 \nL 57.878125 103.249896 \nL 60.929685 103.725343 \nL 63.981244 104.191185 \nL 67.032818 104.647423 \nL 70.084378 105.094054 \nL 73.135938 105.53108 \nL 76.187512 105.958505 \nL 79.239071 106.376322 \nL 81.716227 106.707695 \nL 82.274465 106.778542 \nM 94.517374 108.240876 \nL 97.548436 108.580295 \nL 100.599996 108.912898 \nL 103.651563 109.236389 \nL 106.703122 109.550769 \nL 109.754682 109.856036 \nL 112.806249 110.152188 \nL 113.968764 110.261538 \nL 115.857816 110.430561 \nL 118.909375 110.694936 \nL 121.960942 110.950639 \nL 125.012502 111.197671 \nL 128.064069 111.43604 \nL 131.115628 111.665742 \nL 134.167188 111.886772 \nL 137.218755 112.099135 \nL 140.270314 112.302831 \nL 143.321874 112.497859 \nL 146.373441 112.68422 \nL 149.425 112.861914 \nL 152.476564 113.030936 \nL 155.528127 113.191291 \nL 158.57969 113.342983 \nL 161.631253 113.486004 \nL 164.682813 113.620353 \nL 167.734376 113.746039 \nL 169.542874 113.81539 \nL 170.785939 113.86084 \nL 173.837499 113.964148 \nL 176.889062 114.059192 \nL 179.940626 114.145972 \nL 182.992189 114.224487 \nL 186.04375 114.294739 \nL 189.095313 114.356726 \nL 192.146877 114.410445 \nL 195.198438 114.455904 \nL 198.250001 114.493094 \nL 201.301564 114.522021 \nL 204.353126 114.542683 \nL 207.404689 114.555078 \nL 210.456251 114.559212 \nL 213.507813 114.555078 \nL 216.559376 114.542683 \nL 219.610939 114.522021 \nL 222.662501 114.493094 \nL 225.714063 114.455904 \nL 228.765626 114.410445 \nL 231.817188 114.356726 \nL 234.868751 114.294739 \nL 237.920313 114.224487 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 114.455904 \nL 45.671872 114.90633 \nL 48.723432 115.348496 \nL 51.775006 115.782398 \nL 54.826565 116.208033 \nL 57.878125 116.625402 \nL 60.929685 117.034508 \nL 63.477901 117.369232 \nL 63.981244 117.432411 \nL 67.032818 117.80754 \nL 70.084378 118.174768 \nL 73.135938 118.534104 \nL 76.187512 118.885538 \nL 79.239071 119.229076 \nL 82.290631 119.564717 \nL 85.342191 119.892461 \nL 88.393757 120.212309 \nL 91.44531 120.524255 \nL 94.496869 120.828305 \nL 95.47338 120.923075 \nL 97.548436 121.115889 \nL 100.599996 121.391879 \nL 103.651563 121.660309 \nL 106.703122 121.921177 \nL 109.754682 122.174485 \nL 112.806249 122.420228 \nL 115.857816 122.658411 \nL 118.909375 122.889036 \nL 121.960942 123.112097 \nL 125.012502 123.327593 \nL 128.064069 123.535532 \nL 131.115628 123.735911 \nL 134.167188 123.928724 \nL 137.218755 124.113977 \nL 140.270314 124.29167 \nL 143.321874 124.461801 \nL 143.605786 124.476926 \nL 146.373441 124.618353 \nL 149.425 124.767036 \nL 152.476564 124.908463 \nL 155.528127 125.042637 \nL 158.57969 125.169563 \nL 161.631253 125.289234 \nL 164.682813 125.401648 \nL 167.734376 125.506814 \nL 170.785939 125.604728 \nL 173.837499 125.695385 \nL 174.30988 125.708297 \nM 191.675773 126.079755 \nL 192.146877 126.087033 \nL 195.198438 126.126925 \nL 198.250001 126.159562 \nL 201.301564 126.184946 \nL 204.353126 126.203079 \nL 207.404689 126.213955 \nL 210.456251 126.217583 \nL 213.507813 126.213955 \nL 216.559376 126.203079 \nL 219.610939 126.184946 \nL 222.662501 126.159562 \nL 225.714063 126.126925 \nL 228.765626 126.087033 \nL 231.817188 126.039892 \nL 234.868751 125.985495 \nL 237.920313 125.923846 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 126.126925 \nL 45.671872 126.522197 \nL 48.723432 126.91022 \nL 51.775006 127.290991 \nL 54.826565 127.664506 \nL 57.878125 128.030769 \nL 57.878125 128.030769 \nL 60.929685 128.375701 \nL 63.981244 128.713666 \nL 67.032818 129.044662 \nL 70.084378 129.368688 \nL 73.135938 129.685749 \nL 76.187512 129.995838 \nL 79.239071 130.29896 \nL 82.290631 130.595114 \nL 85.342191 130.884301 \nL 88.393757 131.166519 \nL 91.44531 131.441767 \nL 93.070112 131.584612 \nL 94.496869 131.705313 \nL 97.548436 131.956763 \nL 100.599996 132.201509 \nL 103.651563 132.43955 \nL 106.703122 132.670885 \nL 109.754682 132.895516 \nL 112.806249 133.113439 \nL 115.857816 133.324659 \nL 118.909375 133.529174 \nL 121.960942 133.726982 \nL 125.012502 133.918082 \nL 128.064069 134.102481 \nL 131.115628 134.280175 \nL 134.167188 134.45116 \nL 134.693324 134.479485 \nM 151.953329 135.307471 \nL 152.476564 135.329076 \nL 155.528127 135.448613 \nL 158.57969 135.561693 \nL 161.631253 135.668308 \nL 164.682813 135.768459 \nL 167.734376 135.862153 \nL 170.785939 135.949385 \nL 173.837499 136.030153 \nL 176.889062 136.10446 \nL 179.940626 136.172306 \nL 182.992189 136.233691 \nL 186.04375 136.288614 \nL 189.095313 136.337077 \nL 192.146877 136.379075 \nL 195.198438 136.414616 \nL 198.250001 136.443692 \nL 201.301564 136.466308 \nL 204.353126 136.482462 \nL 207.404689 136.492152 \nL 210.456251 136.495384 \nL 213.507813 136.492152 \nL 216.559376 136.482462 \nL 219.610939 136.466308 \nL 222.662501 136.443692 \nL 225.714063 136.414616 \nL 228.765626 136.379075 \nL 231.817188 136.337077 \nL 234.868751 136.288614 \nL 237.920313 136.233691 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 136.414613 \nL 45.671872 136.766771 \nL 48.723432 137.112458 \nL 51.775006 137.451694 \nL 54.826565 137.784465 \nL 57.878125 138.110766 \nL 60.929685 138.430616 \nL 63.477871 138.692306 \nL 63.981244 138.742187 \nL 67.032818 139.038339 \nL 70.084378 139.328259 \nL 73.135938 139.611942 \nL 76.187512 139.889394 \nL 79.239071 140.160608 \nL 82.290631 140.425588 \nL 85.342191 140.684331 \nL 88.393757 140.936841 \nL 91.44531 141.183116 \nL 94.496869 141.423157 \nL 97.548436 141.656963 \nL 100.599996 141.884534 \nL 103.651563 142.105868 \nL 105.641791 142.246157 \nL 106.703122 142.318434 \nL 109.754682 142.520218 \nL 112.806249 142.715983 \nL 115.857816 142.905721 \nL 118.909375 143.089439 \nL 121.960942 143.267132 \nL 125.012502 143.438798 \nL 128.064069 143.604445 \nL 131.115628 143.764065 \nL 134.167188 143.917665 \nL 137.218755 144.06524 \nL 140.270314 144.206794 \nL 143.321874 144.342322 \nL 146.373441 144.471825 \nL 149.425 144.595307 \nL 152.476564 144.712763 \nL 155.528127 144.8242 \nL 158.57969 144.92961 \nL 161.631253 145.028994 \nL 164.682813 145.122358 \nL 167.734376 145.209702 \nL 170.785939 145.291015 \nL 173.837499 145.366313 \nL 176.889062 145.435579 \nL 177.36027 145.445345 \nM 194.728013 145.719601 \nL 195.198438 145.724708 \nL 198.250001 145.75181 \nL 201.301564 145.772892 \nL 204.353126 145.787954 \nL 207.404689 145.79699 \nL 210.456251 145.8 \nM 210.456251 145.8 \nL 213.507813 145.79699 \nL 216.559376 145.787954 \nL 217.029288 145.785635 \nM 234.398349 145.614215 \nL 234.868751 145.607251 \nL 237.920313 145.556051 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path d=\"M 42.620312 145.724708 \nL 43.320206 145.8 \n\" clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n    <path clip-path=\"url(#p42e1a4deec)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 42.620312 145.8 \nL 42.620312 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 237.920313 145.8 \nL 237.920313 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 42.620312 145.8 \nL 237.920313 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 42.620312 7.2 \nL 237.920313 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"text_10\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 3 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(171.163301 83.694434) rotate(-356.522918) scale(0.08 -0.08)\">\n      <use xlink:href=\"#DejaVuSans-33\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_11\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 6 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(122.262761 98.509614) rotate(-354.356686) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \nQ 1688 2584 1439 2293 \nQ 1191 2003 1191 1497 \nQ 1191 994 1439 701 \nQ 1688 409 2113 409 \nQ 2538 409 2786 701 \nQ 3034 994 3034 1497 \nQ 3034 2003 2786 2293 \nQ 2538 2584 2113 2584 \nz\nM 3366 4563 \nL 3366 3988 \nQ 3128 4100 2886 4159 \nQ 2644 4219 2406 4219 \nQ 1781 4219 1451 3797 \nQ 1122 3375 1075 2522 \nQ 1259 2794 1537 2939 \nQ 1816 3084 2150 3084 \nQ 2853 3084 3261 2657 \nQ 3669 2231 3669 1497 \nQ 3669 778 3244 343 \nQ 2819 -91 2113 -91 \nQ 1303 -91 875 529 \nQ 447 1150 447 2328 \nQ 447 3434 972 4092 \nQ 1497 4750 2381 4750 \nQ 2619 4750 2861 4703 \nQ 3103 4656 3366 4563 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-36\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_12\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 9 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(85.604905 109.417886) rotate(-353.188529) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-39\" d=\"M 703 97 \nL 703 672 \nQ 941 559 1184 500 \nQ 1428 441 1663 441 \nQ 2288 441 2617 861 \nQ 2947 1281 2994 2138 \nQ 2813 1869 2534 1725 \nQ 2256 1581 1919 1581 \nQ 1219 1581 811 2004 \nQ 403 2428 403 3163 \nQ 403 3881 828 4315 \nQ 1253 4750 1959 4750 \nQ 2769 4750 3195 4129 \nQ 3622 3509 3622 2328 \nQ 3622 1225 3098 567 \nQ 2575 -91 1691 -91 \nQ 1453 -91 1209 -44 \nQ 966 3 703 97 \nz\nM 1959 2075 \nQ 2384 2075 2632 2365 \nQ 2881 2656 2881 3163 \nQ 2881 3666 2632 3958 \nQ 2384 4250 1959 4250 \nQ 1534 4250 1286 3958 \nQ 1038 3666 1038 3163 \nQ 1038 2656 1286 2365 \nQ 1534 2075 1959 2075 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-39\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_13\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 12 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(177.856144 128.021988) rotate(-358.774598) scale(0.08 -0.08)\">\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_14\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 15 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(138.131355 136.883395) rotate(-357.236288) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_15\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 18 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(180.91953 147.734109) rotate(-359.095302) scale(0.08 -0.08)\">\n      <defs>\n       <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \nQ 1584 2216 1326 1975 \nQ 1069 1734 1069 1313 \nQ 1069 891 1326 650 \nQ 1584 409 2034 409 \nQ 2484 409 2743 651 \nQ 3003 894 3003 1313 \nQ 3003 1734 2745 1975 \nQ 2488 2216 2034 2216 \nz\nM 1403 2484 \nQ 997 2584 770 2862 \nQ 544 3141 544 3541 \nQ 544 4100 942 4425 \nQ 1341 4750 2034 4750 \nQ 2731 4750 3128 4425 \nQ 3525 4100 3525 3541 \nQ 3525 3141 3298 2862 \nQ 3072 2584 2669 2484 \nQ 3125 2378 3379 2068 \nQ 3634 1759 3634 1313 \nQ 3634 634 3220 271 \nQ 2806 -91 2034 -91 \nQ 1263 -91 848 271 \nQ 434 634 434 1313 \nQ 434 1759 690 2068 \nQ 947 2378 1403 2484 \nz\nM 1172 3481 \nQ 1172 3119 1398 2916 \nQ 1625 2713 2034 2713 \nQ 2441 2713 2670 2916 \nQ 2900 3119 2900 3481 \nQ 2900 3844 2670 4047 \nQ 2441 4250 2034 4250 \nQ 1625 4250 1398 4047 \nQ 1172 3844 1172 3481 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"text_16\">\n    <g clip-path=\"url(#p42e1a4deec)\">\n     <!-- 18 -->\n     <g style=\"fill: #1f77b4\" transform=\"translate(220.646096 147.982332) rotate(-0.565439) scale(0.08 -0.08)\">\n      <use xlink:href=\"#DejaVuSans-31\"/>\n      <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(63.623047 0)\"/>\n     </g>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p42e1a4deec\">\n   <rect x=\"42.620312\" y=\"7.2\" width=\"195.3\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "eta = 2\n",
    "d2l.show_trace_2d(f_2d, d2l.train_2d(adagrad_2d))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-03-02T02:18:50.787852Z",
     "start_time": "2025-03-02T02:18:50.671203Z"
    }
   },
   "id": "fdb1a2ded2165881",
   "execution_count": 2
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 12.7.4. Implementation from Scratch"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "9856c638382f554a"
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "def init_adagrad_states(feature_dim):\n",
    "    s_w = torch.zeros((feature_dim, 1))\n",
    "    s_b = torch.zeros(1)\n",
    "    return (s_w, s_b)\n",
    "\n",
    "def adagrad(params, states, hyperparams):\n",
    "    eps = 1e-6\n",
    "    for p, s in zip(params, states):\n",
    "        with torch.no_grad():\n",
    "            s[:] += torch.square(p.grad)\n",
    "            p[:] -= hyperparams['lr'] * p.grad / torch.sqrt(s + eps)\n",
    "        p.grad.data.zero_()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-03-02T02:22:35.786594Z",
     "start_time": "2025-03-02T02:22:35.781601Z"
    }
   },
   "id": "777e1e0ba3adc892",
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loss: 0.243, 0.071 sec/epoch\n"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 350x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"266.957813pt\" height=\"187.155469pt\" viewBox=\"0 0 266.957813 187.155469\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2025-03-02T10:23:35.030702</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.0, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M -0 187.155469 \nL 266.957813 187.155469 \nL 266.957813 -0 \nL -0 -0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 56.50625 149.599219 \nL 251.80625 149.599219 \nL 251.80625 10.999219 \nL 56.50625 10.999219 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 56.50625 149.599219 \nL 56.50625 10.999219 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"ma9f66e54ae\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#ma9f66e54ae\" x=\"56.50625\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 0.0 -->\n      <g transform=\"translate(48.554688 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \nL 1344 794 \nL 1344 0 \nL 684 0 \nL 684 794 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 105.33125 149.599219 \nL 105.33125 10.999219 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#ma9f66e54ae\" x=\"105.33125\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 0.5 -->\n      <g transform=\"translate(97.379688 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 154.15625 149.599219 \nL 154.15625 10.999219 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#ma9f66e54ae\" x=\"154.15625\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 1.0 -->\n      <g transform=\"translate(146.204688 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-31\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 202.98125 149.599219 \nL 202.98125 10.999219 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#ma9f66e54ae\" x=\"202.98125\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 1.5 -->\n      <g transform=\"translate(195.029688 164.197656) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-31\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 251.80625 149.599219 \nL 251.80625 10.999219 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#ma9f66e54ae\" x=\"251.80625\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 2.0 -->\n      <g transform=\"translate(243.854688 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(95.410156 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_6\">\n     <!-- epoch -->\n     <g transform=\"translate(138.928125 177.875781) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \nL 1159 -1331 \nL 581 -1331 \nL 581 3500 \nL 1159 3500 \nL 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nz\nM 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \nQ 1497 3097 1228 2736 \nQ 959 2375 959 1747 \nQ 959 1119 1226 758 \nQ 1494 397 1959 397 \nQ 2419 397 2687 759 \nQ 2956 1122 2956 1747 \nQ 2956 2369 2687 2733 \nQ 2419 3097 1959 3097 \nz\nM 1959 3584 \nQ 2709 3584 3137 3096 \nQ 3566 2609 3566 1747 \nQ 3566 888 3137 398 \nQ 2709 -91 1959 -91 \nQ 1206 -91 779 398 \nQ 353 888 353 1747 \nQ 353 2609 779 3096 \nQ 1206 3584 1959 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \nL 3122 2828 \nQ 2878 2963 2633 3030 \nQ 2388 3097 2138 3097 \nQ 1578 3097 1268 2742 \nQ 959 2388 959 1747 \nQ 959 1106 1268 751 \nQ 1578 397 2138 397 \nQ 2388 397 2633 464 \nQ 2878 531 3122 666 \nL 3122 134 \nQ 2881 22 2623 -34 \nQ 2366 -91 2075 -91 \nQ 1284 -91 818 406 \nQ 353 903 353 1747 \nQ 353 2603 823 3093 \nQ 1294 3584 2113 3584 \nQ 2378 3584 2631 3529 \nQ 2884 3475 3122 3366 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-65\"/>\n      <use xlink:href=\"#DejaVuSans-70\" transform=\"translate(61.523438 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(125 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(186.181641 0)\"/>\n      <use xlink:href=\"#DejaVuSans-68\" transform=\"translate(241.162109 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_11\">\n      <path d=\"M 56.50625 144.26845 \nL 251.80625 144.26845 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <defs>\n       <path id=\"mdb557c4aed\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mdb557c4aed\" x=\"56.50625\" y=\"144.26845\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 0.225 -->\n      <g transform=\"translate(20.878125 148.067668) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_13\">\n      <path d=\"M 56.50625 117.614603 \nL 251.80625 117.614603 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#mdb557c4aed\" x=\"56.50625\" y=\"117.614603\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 0.250 -->\n      <g transform=\"translate(20.878125 121.413822) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_15\">\n      <path d=\"M 56.50625 90.960757 \nL 251.80625 90.960757 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#mdb557c4aed\" x=\"56.50625\" y=\"90.960757\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 0.275 -->\n      <g transform=\"translate(20.878125 94.759976) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-37\" d=\"M 525 4666 \nL 3525 4666 \nL 3525 4397 \nL 1831 0 \nL 1172 0 \nL 2766 4134 \nL 525 4134 \nL 525 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_17\">\n      <path d=\"M 56.50625 64.306911 \nL 251.80625 64.306911 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#mdb557c4aed\" x=\"56.50625\" y=\"64.306911\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_10\">\n      <!-- 0.300 -->\n      <g transform=\"translate(20.878125 68.10613) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_19\">\n      <path d=\"M 56.50625 37.653065 \nL 251.80625 37.653065 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <g>\n       <use xlink:href=\"#mdb557c4aed\" x=\"56.50625\" y=\"37.653065\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.325 -->\n      <g transform=\"translate(20.878125 41.452284) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_21\">\n      <path d=\"M 56.50625 10.999219 \nL 251.80625 10.999219 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#mdb557c4aed\" x=\"56.50625\" y=\"10.999219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.350 -->\n      <g transform=\"translate(20.878125 14.798438) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_13\">\n     <!-- loss -->\n     <g transform=\"translate(14.798438 89.957031) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-6c\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(27.783203 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(88.964844 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(141.064453 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_23\">\n    <path d=\"M 69.52625 113.556394 \nL 82.54625 124.396844 \nL 95.56625 125.039454 \nL 108.58625 124.420399 \nL 121.60625 125.514315 \nL 134.62625 125.516594 \nL 147.64625 121.495778 \nL 160.66625 124.854749 \nL 173.68625 123.263492 \nL 186.70625 125.561327 \nL 199.72625 124.751749 \nL 212.74625 125.836615 \nL 225.76625 125.227548 \nL 238.78625 125.704753 \nL 251.80625 124.812565 \n\" clip-path=\"url(#p2c643143f1)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 56.50625 149.599219 \nL 56.50625 10.999219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 251.80625 149.599219 \nL 251.80625 10.999219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 56.50625 149.599219 \nL 251.80625 149.599219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 56.50625 10.999219 \nL 251.80625 10.999219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p2c643143f1\">\n   <rect x=\"56.50625\" y=\"10.999219\" width=\"195.3\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data_iter, feature_dim = d2l.get_data_ch11(batch_size=10)\n",
    "d2l.train_ch11(adagrad, init_adagrad_states(feature_dim),\n",
    "               {'lr': 0.1}, data_iter, feature_dim);"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "8c036b99a1d8d3f6",
   "execution_count": 4
  },
  {
   "cell_type": "markdown",
   "source": [
    " # 12.7.5. Concise Implementation"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "1e5b0264424c1cdb"
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loss: 0.242, 0.092 sec/epoch\n"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 350x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"262.1875pt\" height=\"187.155469pt\" viewBox=\"0 0 262.1875 187.155469\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2025-03-02T10:24:53.486346</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.10.0, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M -0 187.155469 \nL 262.1875 187.155469 \nL 262.1875 -0 \nL -0 -0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 56.50625 149.599219 \nL 251.80625 149.599219 \nL 251.80625 10.999219 \nL 56.50625 10.999219 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 56.50625 149.599219 \nL 56.50625 10.999219 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"mb6b6529ce4\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mb6b6529ce4\" x=\"56.50625\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 0 -->\n      <g transform=\"translate(53.325 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 105.33125 149.599219 \nL 105.33125 10.999219 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#mb6b6529ce4\" x=\"105.33125\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 1 -->\n      <g transform=\"translate(102.15 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-31\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 154.15625 149.599219 \nL 154.15625 10.999219 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#mb6b6529ce4\" x=\"154.15625\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 2 -->\n      <g transform=\"translate(150.975 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 202.98125 149.599219 \nL 202.98125 10.999219 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#mb6b6529ce4\" x=\"202.98125\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 3 -->\n      <g transform=\"translate(199.8 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-33\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 251.80625 149.599219 \nL 251.80625 10.999219 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#mb6b6529ce4\" x=\"251.80625\" y=\"149.599219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 4 -->\n      <g transform=\"translate(248.625 164.197656) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_6\">\n     <!-- epoch -->\n     <g transform=\"translate(138.928125 177.875781) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \nL 1159 -1331 \nL 581 -1331 \nL 581 3500 \nL 1159 3500 \nL 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nz\nM 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \nQ 1497 3097 1228 2736 \nQ 959 2375 959 1747 \nQ 959 1119 1226 758 \nQ 1494 397 1959 397 \nQ 2419 397 2687 759 \nQ 2956 1122 2956 1747 \nQ 2956 2369 2687 2733 \nQ 2419 3097 1959 3097 \nz\nM 1959 3584 \nQ 2709 3584 3137 3096 \nQ 3566 2609 3566 1747 \nQ 3566 888 3137 398 \nQ 2709 -91 1959 -91 \nQ 1206 -91 779 398 \nQ 353 888 353 1747 \nQ 353 2609 779 3096 \nQ 1206 3584 1959 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \nL 3122 2828 \nQ 2878 2963 2633 3030 \nQ 2388 3097 2138 3097 \nQ 1578 3097 1268 2742 \nQ 959 2388 959 1747 \nQ 959 1106 1268 751 \nQ 1578 397 2138 397 \nQ 2388 397 2633 464 \nQ 2878 531 3122 666 \nL 3122 134 \nQ 2881 22 2623 -34 \nQ 2366 -91 2075 -91 \nQ 1284 -91 818 406 \nQ 353 903 353 1747 \nQ 353 2603 823 3093 \nQ 1294 3584 2113 3584 \nQ 2378 3584 2631 3529 \nQ 2884 3475 3122 3366 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-65\"/>\n      <use xlink:href=\"#DejaVuSans-70\" transform=\"translate(61.523438 0)\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(125 0)\"/>\n      <use xlink:href=\"#DejaVuSans-63\" transform=\"translate(186.181641 0)\"/>\n      <use xlink:href=\"#DejaVuSans-68\" transform=\"translate(241.162109 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_11\">\n      <path d=\"M 56.50625 144.26845 \nL 251.80625 144.26845 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <defs>\n       <path id=\"mb5ba73d236\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mb5ba73d236\" x=\"56.50625\" y=\"144.26845\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 0.225 -->\n      <g transform=\"translate(20.878125 148.067668) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \nL 1344 794 \nL 1344 0 \nL 684 0 \nL 684 794 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_13\">\n      <path d=\"M 56.50625 117.614603 \nL 251.80625 117.614603 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#mb5ba73d236\" x=\"56.50625\" y=\"117.614603\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 0.250 -->\n      <g transform=\"translate(20.878125 121.413822) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_15\">\n      <path d=\"M 56.50625 90.960757 \nL 251.80625 90.960757 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#mb5ba73d236\" x=\"56.50625\" y=\"90.960757\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 0.275 -->\n      <g transform=\"translate(20.878125 94.759976) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-37\" d=\"M 525 4666 \nL 3525 4666 \nL 3525 4397 \nL 1831 0 \nL 1172 0 \nL 2766 4134 \nL 525 4134 \nL 525 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_17\">\n      <path d=\"M 56.50625 64.306911 \nL 251.80625 64.306911 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#mb5ba73d236\" x=\"56.50625\" y=\"64.306911\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_10\">\n      <!-- 0.300 -->\n      <g transform=\"translate(20.878125 68.10613) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_19\">\n      <path d=\"M 56.50625 37.653065 \nL 251.80625 37.653065 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <g>\n       <use xlink:href=\"#mb5ba73d236\" x=\"56.50625\" y=\"37.653065\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.325 -->\n      <g transform=\"translate(20.878125 41.452284) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_21\">\n      <path d=\"M 56.50625 10.999219 \nL 251.80625 10.999219 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#mb5ba73d236\" x=\"56.50625\" y=\"10.999219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.350 -->\n      <g transform=\"translate(20.878125 14.798438) scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(63.623047 0)\"/>\n       <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(95.410156 0)\"/>\n       <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(159.033203 0)\"/>\n       <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(222.65625 0)\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_13\">\n     <!-- loss -->\n     <g transform=\"translate(14.798438 89.957031) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-6c\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" transform=\"translate(27.783203 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(88.964844 0)\"/>\n      <use xlink:href=\"#DejaVuSans-73\" transform=\"translate(141.064453 0)\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_23\">\n    <path d=\"M 63.01625 115.496526 \nL 69.52625 120.12996 \nL 76.03625 121.451282 \nL 82.54625 115.401978 \nL 89.05625 122.743568 \nL 95.56625 124.58942 \nL 102.07625 119.56577 \nL 108.58625 124.525424 \nL 115.09625 121.921781 \nL 121.60625 121.641424 \nL 128.11625 124.380073 \nL 134.62625 124.183872 \nL 141.13625 123.510738 \nL 147.64625 125.962353 \nL 154.15625 125.672133 \nL 160.66625 124.872078 \nL 167.17625 126.316657 \nL 173.68625 125.688312 \nL 180.19625 123.309884 \nL 186.70625 126.196464 \nL 193.21625 125.748115 \nL 199.72625 126.119568 \nL 206.23625 125.905352 \nL 212.74625 125.91924 \nL 219.25625 126.254086 \nL 225.76625 126.036425 \nL 232.27625 124.883351 \nL 238.78625 125.219405 \nL 245.29625 126.122569 \nL 251.80625 125.61796 \n\" clip-path=\"url(#pdf553d194e)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 56.50625 149.599219 \nL 56.50625 10.999219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 251.80625 149.599219 \nL 251.80625 10.999219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 56.50625 149.599219 \nL 251.80625 149.599219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 56.50625 10.999219 \nL 251.80625 10.999219 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"pdf553d194e\">\n   <rect x=\"56.50625\" y=\"10.999219\" width=\"195.3\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "trainer = torch.optim.Adagrad\n",
    "d2l.train_concise_ch11(trainer, {'lr': 0.1}, data_iter)"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "38e1f3422650fb83",
   "execution_count": 5
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "6aba6d1da7b9535"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
